
package com.ojoin.trade.common.web.controller;

import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ojoin.trade.common.web.domain.Result;
import com.ojoin.trade.common.web.domain.Result.Status;
import com.ojoin.trade.common.web.quartz.QuartzTaskService;

@Controller
@RequestMapping("/system")
public class QuartzMonitorController  extends SimpleBaseController {

	private static final Logger logger = LoggerFactory
			.getLogger(QuartzMonitorController.class);

	@Autowired     
	private QuartzTaskService taskService;     
	
	@ResponseBody
	@RequestMapping(value = "/rescheduleJob", method = RequestMethod.GET)
	public Result rescheduleJob() throws SchedulerException {
			taskService.init(true);
		return new Result(Status.OK, "执行完成");
	}
	
	@ResponseBody
	@RequestMapping(value = "/status", method = RequestMethod.GET)
	public Result status() throws SchedulerException {
		return new Result(Status.OK, taskService.status());
	}

}
